<template>
    <div class="form-mj">

        <div id="form-mj">
            <span>满</span>
            <cube-input
                    class="input"
                    v-model="face"
            >
            </cube-input>
            <span>元，减</span>
            <cube-input
                    class="input"
                    v-model="value_value"
            >
            </cube-input>
            <span>元</span>
        </div>

    </div>
</template>

<script>
export default {
    name: "form-mj",
    data() {
        return {
            face: '',
            value_value: ''
        }
    },
    model: {
      prop: 'value',
      event: 'input'
    },
    props: {
        value: {
            type: Object,
            default() {
                return {}
            }
        }
    },
    computed: {
        values (){
            return {face: this.face, value: this.value_value}
        }
    },
    watch: {
        values (){
            this.$emit('input', this.values)
        },
        value () {
            this.face = this.value.face
            this.value_value = this.value.value
        }
    },
    mounted() {
        this.face = this.value.face
        this.value_value = this.value.value
    }
}
</script>

<style scoped lang="less">
    .form-mj{
        #form-mj{
            width: 100%;
            height: 45px;
            line-height: 45px;
            .input{
                width: 50px;
                height: 30px;
                display: inline-block;
                margin:0 5px;
                text-align: center !important;
                border: 1px solid #eee;
                box-sizing: border-box;
            }
        }
    }
</style>

<style lang="stylus">
    #form-mj input
        text-align center
        height 30px
</style>
